package cn.iocoder.yudao.module.engine.service.log.impl;

import cn.iocoder.yudao.module.engine.model.context.ControlEngineContext;
import cn.iocoder.yudao.module.engine.model.context.EngineSessionContext;
import cn.iocoder.yudao.module.engine.service.log.IEngineLogService;
import cn.iocoder.yudao.module.resource.api.IInteractionLogApi;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class EngineLogServiceImpl implements IEngineLogService {
    @Resource
    private IInteractionLogApi logApi;

    @Override
    public void log(Long userId, String gameMatchId, String wsSessionId, String content) {
        logApi.asynLog(userId, gameMatchId, wsSessionId, content);
    }

    @Override
    public void log(EngineSessionContext engineSessionContext, String content) {
        log(engineSessionContext.getUserId(), engineSessionContext.getGameMatchId(), engineSessionContext.getWsSessionId(), content);
    }

    @Override
    public void log(ControlEngineContext engineContext, String content) {
        log(engineContext.getUserId(), engineContext.getGameMatchId(), engineContext.getWsSessionId(), content);
    }
}
